import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * proteccion tipo 1
 */
public class p1 extends proteccion
{
    public int cont=0;
    public void act() 
    {
        // Add your action code here.
        
         colisionene();
    }  
    public void colisionene()
    {
        space w = (space)getWorld();
        Actor aste = getOneIntersectingObject(asteroide.class);
        Actor ene = getOneIntersectingObject(m1.class);
        Actor ene2 = getOneIntersectingObject(m2.class);
        Actor ene3 = getOneIntersectingObject(m3.class);
        if (aste!=null||ene!=null||ene2!=null||ene3!=null)
        {
           getWorld().addObject( new Explosion(), getX(), getY() );
           if(cont==2)
           {
            getWorld().removeObject(this);
            cont=0;
            w.pt1=0;
           }
            else
            getWorld().removeObject(aste);
            cont++;
        }
       
    }   
}
